#ifndef MIDI_H
#define MIDI_H
#include <vector>
#include <QtCore>
#include <QString>
using namespace std;

struct note{
    long deltaTime;
    unsigned long message;
};
struct info{
    int type;
    vector<unsigned char> detail;
};
struct tempo{
    long deltaTime;
    long tick;
};

struct track{
    vector<info> trkinfos;
    vector<note> trknotes;
};

class midi
{
public:
    midi();
    midi(QString);
    vector<track> midiTrack;
    vector<tempo> tempoMap;
    long dtempo;
private:
    unsigned long setSize(unsigned char buf[4]);
    unsigned long getValue(unsigned char* trk,long &trkpos);
    unsigned long getDTime(unsigned char *trk,long &trkpos);
    track getMidiMsg(unsigned char* trk, long tsize);
    void getTempo(unsigned char* trk,long tsize);


};

#endif // MIDI_H
